package com.heima.user.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

/**
 * @author heima
 * 模拟：用户接收前端提交参数DTO对象
 */
@Data
public class UserDomain {

    private Long id;

    @NotBlank(message = "姓名不能为空")
    @Length(min = 1, max = 6, message = "姓名长度在1-6位之间")
    private String name;

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "您输入邮箱非法")
    private String email;

    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$", message = "您输入手机号格式非法")
    private String mobile;

    @NotNull(message = "年龄不能为空")
    @Min(value = 1,message = "年龄区间值为：1-130")
    @Max(value = 130,message = "年龄区间值为：1-130")
    private Integer age;
}
